package lab3;

import tester.Tester;

public class Examples {

	ISortedList SortedItemA = new EmptySortedList();
	ISortedList SortedItemB = new SortedList(5, SortedItemA);
	ISortedList SortedItemC = new SortedList(3, SortedItemB);
	ISortedList SortedItemD = new SortedList(1, SortedItemC);

	IList ItemA = new EmptyList();
	IList ItemB = new List(16, ItemA);
	IList ItemC = new List(13, ItemB);
	IList ItemD = new List(1, ItemC);
	IList ItemE = new List(500, ItemD);
	IList ItemF = new List(7, ItemE);

	public void testSortedList(Tester T) {

		T.checkExpect(SortedItemD.toString(), "1, 3, 5, End");
		T.checkExpect(SortedItemA.size(), 0);
		T.checkExpect(SortedItemC.size(), 2);
		T.checkExpect(SortedItemD.size(), 3);

		ISortedList newSortedList = SortedItemD.addElt(10);
		T.checkExpect(newSortedList.toString(), "1, 3, 5, 10, End");

	}

	public void testSort(Tester T) {
		T.checkExpect(ItemF.sort(), "1, 7, 13, 16, 500, End");
	}

	public static void main(String[] args) {
		Tester.run(new Examples());
	}
	
	/*
	 * Question 5:
	 * 	In the case of this lab SortedList, it will not matter to add duplicates, since there is no method to remove elements
	 *  But in the case of a priority queue, there will be a problem of where to add the element in the list, before or after the ones that already exist with the same value
	 *  And the problem of removing it. It is much depended on the methodology of the code
	 */
	
	/*
	 * Question 6:
	 * 	To make the ISortedList an implementation of IList, so all the methods of the IList is passed on.
	 * 	The return value of a sort() on a ISortedList will only return the list it self
	 */
}
